<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script type='text/javascript' src='js/vue.js'></script>
    <style>
        .active {
            background-color: yellowgreen;
            width: 200px;
            height: 100px;
        }
        .sty {
            text-align: center;
            line-height: 100px;
            color: #fff;
        }
    </style>
</head>
<body>
    <div id='app'>
        <div :class="{active:isActive}">class绑定样式</div>
        <hr>
        <div :class="[active,isActive ? sty : '']" :style="color">class绑定样式2</div>
        <button @click="change">切换</button>
    </div>
    <script type='text/javascript'>
        var vm = new Vue({
            el: '#app',
            data: {
                msg: 'Hello Vue',
                isActive:true,
                active:'active',
                sty: 'sty',
                color: {color:'red'}
            },
            methods: {
                change(){
                    this.isActive = !this.isActive
                }
            }
        });
    </script>
</body>
</html>